package com.shiwaixiangcun.monitor.domain;


import com.rabbit.spring.data.domain.BaseEntity;
import com.shiwaixiangcun.monitor.enums.PriorityLevel;
import com.shiwaixiangcun.monitor.enums.WorkOrderStatus;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Type;

import javax.persistence.*;

/**
 * 工单信息
 */
@Entity
@Table(name = "ms_workorder")
@DynamicUpdate
@DynamicInsert
public class WorkOrder extends BaseEntity<Long> {

    private String number;//工单编号

    private String title;//标题

    @Type(type = "text")
    private String content;//内容

    @Enumerated(EnumType.STRING)
    private PriorityLevel priorityLevel;//工单优先级

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "category_id")
    private WorkOrderCategory category;

    @Enumerated(EnumType.STRING)
    private WorkOrderStatus status;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private User user; //受理人

    private Boolean timeout; //工单是否超时


    public WorkOrder() {
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public PriorityLevel getPriorityLevel() {
        return priorityLevel;
    }

    public void setPriorityLevel(PriorityLevel priorityLevel) {
        this.priorityLevel = priorityLevel;
    }

    public WorkOrderCategory getCategory() {
        return category;
    }

    public void setCategory(WorkOrderCategory category) {
        this.category = category;
    }

    public WorkOrderStatus getStatus() {
        return status;
    }

    public void setStatus(WorkOrderStatus status) {
        this.status = status;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Boolean getTimeout() {
        return timeout;
    }

    public void setTimeout(Boolean timeout) {
        this.timeout = timeout;
    }
}
